<template>
	<view class="noticeDetail">
		<view class="header">
           <text class="title">{{title}}</text>
           <text class="time">{{time}}</text>
        </view>
		<view class="content">
			<wxParse :content="content" />
		</view>
	</view>
</template>

<script>
	import wxParse from '../../components/mpvue-wxparse/src/wxParse.vue';
	var util = require('../../common/util.js')
export default {
    data() {
        return {
            title: '',
            time: '',
						content:'加载中...'
        };
    },
	onLoad(option) {
		console.log(option.id);
		        uni.showLoading({
		            title: '正在加载...'
		        });
		        util.ajax(
		            'newsDetail',
		            {
		                targetId: option.id
		            },
		            data => {
		                uni.hideLoading();
		                let json = data.data;
		                if (json.status) {
											uni.setStorageSync(String(option.id), true);
											// item.isRead = uni.getStorageSync(String(item.newsId));
		                    console.log(json);
		                    this.title = json.data.info.title 
												this.time = util.parseTime(json.data.createTime)
		                    this.content = json.data.info.content;
		                }
		            },
		            (data, code) => {
		                console.log(data);
		                uni.showToast({
		                    title: JSON.stringify(data.message),
		                    icon: 'none',
		                    duration: 1000
		                });
		            }
		        );
		
	},
	components:{
		wxParse
	},
    methods: {
       
    }
};
</script>

<style lang="less">
	@import url('../../components/mpvue-wxparse/src/wxParse.css');
	page{
		background: white;
	}
.noticeDetail {
    flex: 1;
    flex-direction: column;
	padding:22upx 30upx;
	background: white;
	height: 100%;
	.header{
		flex: 1;
		flex-direction: column;
		margin-bottom: 50upx;
	}
	.content {
	        width: 100%;
	        .wxParse {
	            width: 100%;
	            view {
	                max-width: 100%;
	                .p {
	                    max-width: 100%;
	                }
	            }
	
	            flex-direction: column;
	        }
	    }

}
</style>
